package jdbctest;

import javax.swing.plaf.nimbus.State;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo3 {
    public static void main(String[] args) {
        try(Connection connection = DBUtil.getConnection()) {
            Statement statement = connection.createStatement();
            String sql = "UPDATE user\n" +
                    "SET password = '666666',nickname = '老三',age = 50\n" +
                    "WHERE id = 1;";
            int num = statement.executeUpdate(sql);
            System.out.println(num > 0? "修改成功":"修改失败");

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
